<?php
/* @var $this ImageController */
/* @var $model Image */
/* @var $form bootstrap.widgets.TbActiveForm */
?>


<?php $form=$this->beginWidget('bootstrap.widgets.TbActiveForm', array(
	'id'=>'image-form',
	// Please note: When you enable ajax validation, make sure the corresponding
	// controller action is handling ajax validation correctly.
	// There is a call to performAjaxValidation() commented in generated controller code.
	// See class documentation of CActiveForm for details on this.
	'enableAjaxValidation'=>false,
	'htmlOptions'=>array('enctype' => 'multipart/form-data'),

)); ?>

	<p class="help-block">Fields with <span class="required">*</span> are required.</p>

	<?php echo $form->errorSummary($model); ?>

		<?php echo 'Gallery: ' ?>
		<?php echo $form->hiddenField($model,'galleryId'); ?>
		<?php echo $model->gallery->name; ?>
		<?php echo $form->textFieldRow($model,'name',array('class'=>'span3','maxlength'=>255)); ?>

		<?php echo $form->dropDownListRow($model,'mediaFormat',$model->getMediaOptions()); ?>

	<?php echo $form->labelEx($model,'description'); ?>
	<?php $this->widget('ext.redactor.ImperaviRedactorWidget', array(
	    // You can either use it for model attribute
	    'model' => $model,
	    'attribute' => 'description',
	)); ?>
	<?php echo $form->error($model,'description'); ?>
		<?php echo $form->textFieldRow($model,'url',array('size'=>60)); ?>
		<?php echo $form->checkBoxRow($model,'thumbnail'); ?>

		<?php echo $form->textFieldRow($model,'dateTaken',array('class'=>'span3','maxlength'=>255)); ?>
<?php echo $form->labelEx($model, 'theImage'); ?>
<?php echo $form->fileField($model, 'theImage'); ?>
<?php echo $form->error($model, 'theImage'); ?>
<?php if($model->isNewRecord!='1')
echo CHtml::image(Yii::app()->request->baseUrl.'/images/'.$model->slug,"image",array("width"=>200));
?>

	<div class="form-actions">
		<?php $this->widget('bootstrap.widgets.TbButton', array(
			'buttonType'=>'submit',
			'type'=>'primary',
			'label'=>$model->isNewRecord ? 'Create' : 'Save',
		)); ?>
	</div>

<?php $this->endWidget(); ?>

